import http from '@/service'

// ========== 字典类型 ==========
export function selectDictType(params: any) {
	return http.get({
		url: '/system/dict/type',
		params
	})
}
export function insertDictType(data: any) {
	return http.post({
		url: '/system/dict/type/insert',
		data
	})
}
export function updateDictType(data: any) {
	return http.patch({
		url: '/system/dict/type/update',
		data
	})
}
export function deleteDictType(dictId: number) {
	return http.delete({
		url: '/system/dict/type/delect/' + dictId
	})
}
// ========== 字典数据 ==========
export function selectDictData(params: string) {
	return http.get({
		url: '/system/dict/data/' + params
	})
}
export function insertDictData(data: any) {
	return http.post({
		url: '/system/dict/data/insert',
		data
	})
}
export function updateDictData(data: any) {
	return http.patch({
		url: '/system/dict/data/update',
		data
	})
}
export function deleteDictData(dictCode: number) {
	return http.delete({
		url: '/system/dict/data/delete/' + dictCode
	})
}

// 组件接口：根据字典类型查询状态为正常的字典数据
export function selectTypeToData(params: string) {
	return http.get({
		url: '/system/dict/' + params
	})
}
